#ifndef __Vector_h
#define __Vector_h

#include  <vector>
#include  <iostream>
#include  <iterator>

/*----------------------------------------------------------*/

class Vector : public std::vector<double>
{
public:
  typedef std::vector<double>::iterator iterator;
  typedef std::vector<double>::const_iterator const_iterator;

  ~Vector()  {}
  Vector() : std::vector<double>()    {}
  Vector(size_t n) : std::vector<double>(n, 0.0)   {}
  Vector(const Vector& v) : std::vector<double>(v)
  {
    reSize( v.size() );
    *this = v;
  }

  void reSize(size_t n)
  {
    std::vector<double>::reserve(n);
    std::vector<double>::resize(n);
  }

  friend std::ostream& operator<<(std::ostream& s, const Vector& A)
  {
    if( !A.size() )
    {
      return s;
    }
    std::ostream_iterator<double>  os(s, " ");
    copy(A.begin(), A.end(), os);
    return s;
  }

  friend std::istream& operator>>(std::istream& s, Vector& A)
  {
    iterator p = A.begin();
    while( p != A.end() )
    {
      s>>*p++;
    }
    return s;
  }

  double operator*(const Vector& v) const;
  Vector&   operator=(const double d)
  {
    equal(d);
    return *this;
  }

  void zero();
  void equal(const double);
  void equal(const Vector&);
  void equal(const double, const Vector&);
  void add  (const double, const Vector&);
  double max() const;
  double min() const;
  const double  norm_1()     const;
  const double  norm_2()     const;
  const double  norm_infty()     const;
};

#endif
